import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

SECRET_KEY = '51)fj#mnm%-ctk6+$eah%5=rv(rsl(2k5ntivjgt&7f3=%a7j+'

DEBUG = False

ALLOWED_HOSTS = ["*"]

INSTALLED_APPS = [
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    "corsheaders",
    "rest_framework",
    'rest_framework.authtoken',
    "apps.user",
    "apps.order",
    "apps.products",
    "apps.orderproducts",
    "apps.devices",
    "apps.publish"
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    "corsheaders.middleware.CorsMiddleware",
    'django.middleware.common.CommonMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    "util.mypermission.MyPermission",
    "util.md.Md1",
]
CORS_ALLOW_METHODS = (
    'DELETE',
    'GET',
    'OPTIONS',
    'PATCH',
    'POST',
    'PUT',
    'VIEW',
)

CORS_ALLOW_HEADERS = (
    'accept',
    'accept-encoding',
    'authorization',
    'content-type',
    'dnt',
    'origin',
    'user-agent',
    'x-csrftoken',
    'x-requested-with',
    "X-Access-Token"
)

REST_FRAMEWORK = {
    'DEFAULT_RENDERER_CLASSES': [
        'rest_framework.renderers.JSONRenderer',
    ]
}

ROOT_URLCONF = 'config.urls'

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

LANGUAGE_CODE = 'zh-cn'

TIME_ZONE = "Asia/Shanghai"

USE_I18N = True

USE_L10N = True

USE_TZ = False

STATIC_URL = '/static/'

CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True
CORS_ORIGIN_WHITELIST = ()


# token过期时间
TOKEN_TIME = 24 * 60 * 60

# 重启网关
REBOOT_GATEWAY = 1

# 重启传感器
REBOOT_SENSOR = 2

# 升级网关
UPDATE_GATEWAY = 3

# 升级传感器
UPDATE_SENSOR = 4

# 读网关版本号
READ_GATEWAY = 5

# 读传感器版本号
READ_SENSOR = 6

# 上传配置文件
UPLOAD_DEPLOY = 7

# 上传日志文件
UPLOAD_LOG = 8

# 下载脚本文件
DOWN_SCRIPT = 9

# 下载配置文件
DOWN_DEPLOY = 10

# 采集数据
GET_DATA = 11

# 升级协议文件
AGREEMENT_GATEWAY = 12

# 主程序升级
MAIN_GATEWAY = 13

# tac31配置文件
CONFIG_GATEWAY = 14

# tac31关机指令
POWEROFF = 15

# 查询卡状态
QUERY_SIM = 16

# 查询卡状态
ADD_SIM = 17

# 网关clientid配置
ID_HEAD = "TIAID"
ID_END = "-2"

# tac03
NEW_GATEWAY_NAME = "tia"

# json解释文件名称
JSON_EXPLAIN_FILE = "json_explain_file.json"

TRANSID_NUMBER = "transid_number"
SVN_USERNAME = "publisher"
SVN_PASSWORD = "U6cdF*_bo#ix*i33"
SVN_HEAD = "svn://192.168.2.12/publish/"
HARDWARE = 1
TOOLWARE = 2
PARAMETER = 3
SOFTWARE = 4

